{template header}

    <div class="box">
    <!--{if $a == 'index'}-->
        <div class="navi">
            <div class="btn-group right">
                <a class="btn btn-success" href="{$this->url($c, 'add', array('type' => $this->type) )}">添加{$this->name}</a>
                <a class="btn btn-success dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <!--{loop $this->tab $k $v}-->
                    <li><a href="{$this->url($c, 'add', array('type' => $k) )}">{$v}</a></li>
                    <!--{/loop}-->
                </ul>
            </div>

            <button class="btn btn-small">筛选：</button>
            <a class="btn btn-small" href="{$this->url($c)}">全部{$this->name}</a>

            <div class="btn-group">
                <a class="btn btn-small" href="{$this->url($c, null, $this->get('sid'))}">所有分类</a>
                <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                <ul class="dropdown-menu">
                    <!--{loop $this->sort $v}-->
                    <li><a href="{$this->url($c, null, $this->get(array('sid' => $v['id'] )) )}">{$v['treeTitle']}</a></li>
                    <!--{/loop}-->
                </ul>
            </div>

            <div class="btn-group">
                <a class="btn btn-small" href="{$this->url($c, null, $this->get('dateline'))}">所有时间</a>
                <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                <ul class="dropdown-menu">
                    <!--{loop $this->viewDate $k $v}-->
                    <li><a href="{$this->url($c, null, $this->get(array('dateline' => $k)) )}">{$v}</a></li>
                    <!--{/loop}-->
                </ul>
            </div>

            <div class="btn-group">
                <<a class="btn btn-small" href="{$this->url($c, null, $this->get('k'))}">所有属性</a>
                <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                <ul class="dropdown-menu">
                    <!--{loop $this->viewAttr $k $v}-->
                    <li><a href="{$this->url($c, null, $this->get(array('k' => $k )) )}">{$v}</a></li>
                    <!--{/loop}-->
                </ul>
            </div>

            <div class="btn-group">
                <a class="btn btn-small" href="{$this->url($c, null, $this->get('order-by') )}">默认排序</a></li>
                <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                <ul class="dropdown-menu">
                <!--{loop $this->viewOrder $k $v}-->
                    <!--{if strpos($k, 'divider') === false}-->
                    <li><a href="{$this->url($c, null, $this->get(array('order' => $v)) )}">{$k}</a></li>
                    <!--{else}-->
                    <li class="divider"></li>
                    <!--{/if}-->
                <!--{/loop}-->
                </ul>
            </div>
        </div>
        <div class="clear"></div>
        {template title}

        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <th width="7%">选择</th>
                <th width="15%">分类
                <th>标题</th>
                <th width="7%">评论</th>
                <th width="7%">浏览</th>
                <th width="13%">操作</th>
            </tr>

        <!--{if $result[ 'result' ]}-->
            <!--{loop $result['result'] $val}-->
            <tr>
                <td><input type="checkbox" name="id" value="{$val['id']}" /></td>
                <td>[ <a class="over1" href="{$this->url($c, null, array('sid' => $val['sid']))}">{$this->sort[$val['sid']]['title']}</a> ]</td>
                <td class="td2 subject">
                    <a href="{$this->url($c, 'edit', array('id' => $val['id'], 'type' => $val['model']))}" title="{$val['title']}">
                        {$this->get_title($val['title'])}</a><span class='date'>{echo formatDate($val['dateline'])}</span>
                    <!--{if $val['isTop']}--><span style="color: blue;">[置顶]</span><!--{/if}-->
                    <!--{if $val['attachments']}--><img src="{$this->themesURL}/images/image.png" title="附件" /><!--{/if}-->
                </td>
                <td>{$val['comments']}</td>
                <td>{$val['views']}</td>
                <td>
                    <a class="btn btn-mini btn-info" title="{$this->top[$val['isTop']]}" href="{$this->url($c, 'top', array('id' => $val['id'], 'v' => $val['isTop'] ) )}">{$this->top[$val['isTop']]}</a>
                    <a title="删除{$this->name}" class="del btn btn-mini btn-danger" href="{$this->url($c, 'del', array('id' => $val['id']))}">删除</a>
                </td>
            </tr>
            <!--{/loop}-->
        <!--{else}-->
            <tr>
                <td colspan="6">没有{$this->name}!</td>
            </tr>
        <!--{/if}-->

            <tr>
                <td colspan="6" class="td2">
                    <div class="btn-group">
                        <button class="btn btn-small btn-info btn-all">全选</button>
                    </div>
                    <div class="btn-group multiple">
                        <button class="btn btn-small">批量操作:</button>
                        <a class="btn btn-small" href="{$this->url($c, 'delAll')}" title="删除{$this->name}">删除</a>
                        <a class="btn btn-small" href="{$this->url($c, 'topAll', array( 'v' => 1 ) )}" title="置顶{$this->name}">置顶</a>
                        <a class="btn btn-small" href="{$this->url($c, 'topAll', array( 'v' => 0 ) )}" title="取消置顶">取消置顶</a>
                        <a class="btn btn-small" href="{$this->url($c, 'hide', array( 'v' => 0 ) )}" title="显示{$this->name}">显示</a>
                        <a class="btn btn-small" href="{$this->url($c, 'hide', array( 'v' => 1 ) )}" title="隐藏{$this->name}">隐藏</a>
                    </div>
                    <div class="btn-group dropup">
                        <button class="btn btn-small">移动{$this->name}</button>
                        <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                        <ul class="dropdown-menu mv">
                            <!--{loop $this->sort $tree}-->
                            <li><a href="{$this->url($c, 'mv', array( 'v' => $tree['id'] ) )}">{echo str_replace('├', '',$tree['treeTitle'])}</a></li>
                            <!--{/loop}-->
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
        <!--{if $result[ 'page' ]}-->
        <div class="navi top">
            <div class="page">{$result[ 'page' ]}</div>
            <div class="search">
                <form action="{$this->url($c, null, $this->get('key'))}">
                    <input type="text" name="key" class="span3" placeholder="请输入{$this->name}名称" />
                    <button type="button" class="btn">搜索</button>
                </form>
            </div>
            <div class="clear"></div>
        </div>
        <!--{/if}-->
    <!--{/if}-->
    <!--{if $a == 'add' || $a == 'edit' }-->
    <form method="post" action="{$this->url($c, 'save', array('id' => $result['id']))}">
        <input type="hidden" name="{$c}[model]" value="{$this->type}" />
        <input type="hidden" name="{$c}[uid]" value="{$this->admin['id']}" />
        <input type="hidden" name="attach[id]" value="" />
        <table cellpadding="1" cellspacing="1" width="100%" border="0">

            <tr>
                <td width="25%">{$this->name}名称：</td>
                <td class="td2">
                    <input type="text" name="{$c}[title]" placeholder="请输入{$this->name}名称" class="required span5" value="{$a == 'edit' ? $result['title'] : ''}" />
                </td>
            </tr>
            <tr>
                <td>{$this->name}分类：</td>
                <td class="td2">
                    <select name="{$c}[sid]" class="sid">
                    <!--{if $this->sort}-->
                        <!--{loop $this->sort $tree}-->
                        <option value="{$tree['id']}"{$tree['id'] == $result['sid'] ? ' selected' : ''}>{$tree['treeTitle']}</option>
                        <!--{/loop}-->
                    <!--{else}-->
                        <option value="0">未分类</option>
                    <!--{/if}-->
                    </select>
                </td>
            </tr>

            <tr>
                <td>{$this->name}描述：</td>
                <td class="td2">
                    <textarea name="{$c}[excerpt]" id="excerpt" style="width:97%;height:130px;">{$a == 'edit' ? htmlspecialchars_decode($result['excerpt']) : ''}</textarea>
                    <script src="{$this->setting['weburl']}/content/editor/editor.js?v={echo time()}"></script>
                    <script>showEdit2();</script>
                </td>
            </tr>

            <tr>
                <td>{$this->name}缩略图 ：</td>
                <td class="td2">
                    <input type="text" name="{$c}[thumb]" class="span5" value="{$a == 'edit' ? $result['thumb'] : ''}" />
                </td>
            </tr>

            <tr>
                <th colspan="2" class="td2">{$this->name}地址：</th>
            </tr>

            <!--{loop $this->play_sort $v}-->
            <tr class="vod">
                <td>{$v['title']}地址：</td>
                <td class="td2"><input type="text" name="vod[{$v['id']}]" class="span6" value="{$a == 'edit' ? $result['content'][$v['id']] : ''}" /></td>
            </tr>
            <!--{/loop}-->

            <tr>
                <th colspan="2" class="td2">{$this->name}属性：</th>
            </tr>

            <tr>
                <td>{$this->name}标签 ：</td>
                <td class="td2">
                    <input type="hidden" name="oldtag" value="{$result['tag']}" />
                    <input type="text" name="tag" class="span4" data-provide="typeahead" data-source='[{$this->tag_list()}]' value="{$a == 'edit' ? $result['tag'] : ''}" />
                    <span class="lable">标签之间用英文,号隔开! 最多6个标签</span>
                </td>

            </tr>
            <tr>
                <td>{$this->name}{$this->type == 'link' ? '地址' : '别名'}：</td>
                <td class="td2">
                    <input type="text" name="{$c}[alias]" class="span4{$this->type == 'link' ? ' required' : ''}" value="{$a == 'edit' ? $result['alias'] : ''}" />
                </td>
            </tr>
            <tr>
                <td>发布时间：</td>
                <td class="td2">
                    <input type="text" id="dateline" name="{$c}[dateline]" value="{$a == 'edit' ? date($this->setting['timeformat'], $result['dateline']) : date($this->setting['timeformat'], time())}" readonly />
                    <span class="lable">
                        <a href="" class="dateline btn btn-small">插入当前时间</a>
                    </span>
                </td>
            </tr>
            <tr class="hidden">
                <td>{$this->name}排序 ：</td>
                <td class="td2">
                    <input type="text" name="{$c}[oid]" class="span1" value="{$a == 'edit' ? $result['oid'] : ''}" />
                    <span class="lable">数值越大越靠前显示</span>
                </td>
            </tr>
            <tr class="hidden">
                <td>选项：</td>
                <td class="td2">
                    <label class="checkbox inline">
                        <input type="checkbox" name="{$c}[isTop]" value="1"{$a == 'edit' && $result['isTop'] ? 'checked' : ''} />置顶
                    </label>
                    <label class="checkbox inline">
                        <input type="checkbox" name="{$c}[isHide]" value="1"{$a == 'edit' && $result['isHide'] ? 'checked' : ''} />隐藏
                    </label>
                    <label class="checkbox inline">
                        <input type="checkbox" name="{$c}[isLock]" value="1"{$a == 'edit' && $result['isLock'] ? 'checked' : ''} />禁止评论
                    </label>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="td3">
                    <a title="保存{$this->name}" class="btn btn-success save_article" href="{$this->url($c, null, array('type' => $this->type))}">保 存</a>
                    <label class="checkbox inline">
                        <input type="checkbox" class="show" />高级选项
                    </label>
                </td>
            </tr>
        </table>
    </form>

    <script type="text/javascript">
        $( function () {
            $( ".save_article" ).click( function () {
                var tagobj = $( 'input[name="tag"]' );
                var tag = $.trim( tagobj.val() );
                if ( tag != '' && tag.indexOf( ',' ) != -1 ) {
                    var tags = tag.split( ',' );
                    if ( tags.length - 1 > 6 ) {
                        tagobj.focus();
                        $.jBox.tip( '最多6个标签', 'error' );
                        return false;
                    }
                }
                ajaxPOST( $( this ) );
                return false;
            });
        });
    </script>
    <!--{/if}-->
    </div>
{template footer}